package com.taobao.askwho.job;

import java.util.Map;
import java.util.Map.Entry;

import com.taobao.askwho.ao.TagAo;
import com.taobao.askwho.po.TagMemory;
import com.taobao.askwho.utils.CloudTagUtils;
import com.taobao.askwho.utils.WorldPressCloudTagUtils;

public class LoadDataToMemoryTable {
	public void loadTagInfoToMemory() {
        TagAo.get().deleteTagMemoryAll();
		Map<String, Long> map = TagAo.get().queryAllTaqsFromTagRelation();
		for(Entry<String,Long> entry : map.entrySet()) {
			TagMemory po = new TagMemory();
			po.setTagName(entry.getKey());
			po.setCount(entry.getValue());
			TagAo.get().addTagMemoryNoCheck(po);
		}
        //CloudTagUtils.calculateCloudFromMemory();
		WorldPressCloudTagUtils.calculateCloud();
	}
}
